﻿using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Domain.Entities.Auditing;
namespace YunDrug.EmployeeAuthorization
{
    /// <summary>
    /// 功能模块信息
    /// </summary>
   public  class FunctionModule:AuditedAggregateRoot<Guid>
    {
        public FunctionModule(Guid upperId, int sort, string describe, string name, string url, bool visible, bool status)
        {
            UpperId = upperId;
            Sort = sort;
            Describe = describe ?? throw new ArgumentNullException(nameof(describe));
            Name = name ?? throw new ArgumentNullException(nameof(name));
            Url = url ?? throw new ArgumentNullException(nameof(url));
            Visible = visible;
            Status = status;
            PageElements = new List<FunctionModulePageElement>();
        }

        /// <summary>
        /// 上级功能模块编码
        /// </summary>
        public Guid UpperId { get; set; }
        /// <summary>
        /// 功能排序码
        /// </summary>
        public int Sort { get; set; }
        /// <summary>
        /// 功能描述
        /// </summary>
        public string Describe { get; set; }
        /// <summary>
        /// 功能名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 功能目标地址
        /// </summary>
        public string Url { get; set; }
        /// <summary>
        /// 是否可见
        /// </summary>
        public bool Visible { get; set; }
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Status { get; set; }
        /// <summary>
        /// 菜单按钮
        /// </summary>
        public virtual List<FunctionModulePageElement> PageElements { get;protected set; }
        /// <summary>
        /// 添加菜单按钮
        /// </summary>
        /// <param name="pageElementId"></param>
        public void AddPageElement(string pageElementId)
        {
            PageElements.Add(new FunctionModulePageElement(this.Id, pageElementId));
        }
        
    }
}
